package yh;

/**
 * @Author:云尚
 * @Description:方法的递归
 * 用方法打印1-100的数
 */
public class RecursiveDemo {
    //1.用递归的方式：从1打印到100
    void print(int i){
        if(i<=100){
            System.out.println(i);
            i++;
            print(i);
        }
    }

    public static void main(String[] args) {
        RecursiveDemo recursiveDemo=new RecursiveDemo();
        recursiveDemo.print(1);
    }
}
